package com.example.redis.controller;

import com.example.redis.entity.OnlineDevices;
import com.example.redis.service.RedisService;
import com.example.redis.util.Result;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.Set;

@RestController
@CrossOrigin
@RequiredArgsConstructor
@RequestMapping("/redisApi")
public class RedisController {
    private final RedisService redisService;

    @GetMapping("/onlineDevices")
    public Result<OnlineDevices> getOnlineDevices(@RequestParam(value="prefix", required = false)String prefix){
        return redisService.getOnlineDevices(prefix);
    }
}
